feat(BA-6626): app_config_fragment bulk repository layer#12426
Conversation
cf41d87 to
ffa35db
Compare
Bulk create/update/purge for app_config_fragment at the service layer, on top of the repository primitives in #12426 (BA-6626): - Bulk actions carrying BulkConditional{Creator,Updater,Purger} payloads, service methods, and BulkActionProcessor wiring (per-entity RBAC extension point; no validator yet). - Partial-success results (succeeded + failed[index, message]). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ffa35db to
bcc97bb
Compare
Bulk create/update/purge for app_config_fragment at the service layer, on top of the repository primitives in #12426 (BA-6626): - Bulk actions carrying BulkConditional{Creator,Updater,Purger} payloads, service methods, and BulkActionProcessor wiring (per-entity RBAC extension point; no validator yet). - Partial-success results (succeeded + failed[index, message]). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
bcc97bb to
846bc64
Compare
Bulk create/update/purge for app_config_fragment at the service layer, on top of the repository primitives in #12426 (BA-6626): - Bulk actions carrying BulkConditional{Creator,Updater,Purger} payloads, service methods, and BulkActionProcessor wiring (per-entity RBAC extension point; no validator yet). - Partial-success results (succeeded + failed[index, message]). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
87bcc0c to
c83c084
Compare
846bc64 to
ef67230
Compare
Bulk create/update/purge for app_config_fragment at the service layer, on top of the repository primitives in #12426 (BA-6626): - Bulk actions carrying BulkConditional{Creator,Updater,Purger} payloads, service methods, and BulkActionProcessor wiring (per-entity RBAC extension point; no validator yet). - Partial-success results (succeeded + failed[index, message]). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
c83c084 to
7cda3f9
Compare
ef67230 to
f2316f2
Compare
Bulk create/update/purge for app_config_fragment at the service layer, on top of the repository primitives in #12426 (BA-6626): - Bulk actions carrying BulkConditional{Creator,Updater,Purger} payloads, service methods, and BulkActionProcessor wiring (per-entity RBAC extension point; no validator yet). - Partial-success results (succeeded + failed[index, message]). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
7cda3f9 to
614eaf0
Compare
f2316f2 to
3462f91
Compare
Bulk create/update/purge for app_config_fragment at the service layer, on top of the repository primitives in #12426 (BA-6626): - Bulk actions carrying BulkConditional{Creator,Updater,Purger} payloads, service methods, and BulkActionProcessor wiring (per-entity RBAC extension point; no validator yet). - Partial-success results (succeeded + failed[index, message]). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
614eaf0 to
6d69904
Compare
3462f91 to
14f10a1
Compare
398066c to
b8cdd23
Compare
e3d03c1 to
152cfac
Compare
Bulk create/update/purge for app_config_fragment at the service layer, on top of the repository primitives in #12426 (BA-6626): - Bulk actions carrying BulkConditional{Creator,Updater,Purger} payloads, service methods, and BulkActionProcessor wiring (per-entity RBAC extension point; no validator yet). - Partial-success results (succeeded + failed[index, message]). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
3e1272d to
b1e8537
Compare
152cfac to
0a82ba7
Compare
Bulk create/update/purge for app_config_fragment at the service layer, on top of the repository primitives in #12426 (BA-6626): - Bulk actions carrying BulkConditional{Creator,Updater,Purger} payloads, service methods, and BulkActionProcessor wiring (per-entity RBAC extension point; no validator yet). - Partial-success results (succeeded + failed[index, message]). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
b1e8537 to
ce15831
Compare
801351d to
ab3e072
Compare
Build the app_config_fragment bulk repository on the conditional-bulk primitives (#12429): - bulk_create / bulk_update / bulk_purge in db_source + repository, returning AppConfigFragmentBulkWriteResult (succeeded + failed[index, message]) — partial success via the WriteOps.bulk_*_partial primitives. - bulk_create takes plain Creators; the FK to the allow-list is the gate, so an item with no allow-list row fails per-item as AppConfigFragmentWriteNotAllowed (via the spec's integrity checks) while the rest are created. - Repository unit tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR adds the repository-layer bulk operations (bulk_create / bulk_update / bulk_purge) for app_config_fragment, split out of the bulk service-layer PR (#12401) to keep it reviewable. It builds directly on the generic partial-bulk primitives already in WriteOps (bulk_create_partial / bulk_update_partial / bulk_purge_partial) and introduces no new base primitives. Each item runs in its own savepoint for partial success; failures are reported per item with a batch index and reason. It fits into the AppConfigFragment/AppConfig stack under BEP-1052 as the layer beneath the upcoming bulk CRUD service.
Changes:
- New
AppConfigFragmentBulkWriteResult/AppConfigFragmentBulkItemErrordata types carryingsucceeded+failed[index, message]. db_sourcebulk methods: create relies on the allow-list FK as the per-item gate; update/purge reconstruct missing-target "not found" failures from the base result (missing PKs are silently skipped by the primitive).- Real-DB repository tests covering all-success and partial (not-allow-listed create / missing update / missing purge) paths, plus a changelog fragment.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/ai/backend/manager/data/app_config_fragment/types.py | Adds the bulk-result and per-item error data types. |
| src/ai/backend/manager/repositories/app_config_fragment/db_source/db_source.py | Implements bulk create/update/purge over the partial ops, mapping successes/errors and reconstructing not-found failures. |
| src/ai/backend/manager/repositories/app_config_fragment/repository.py | Delegates the three bulk methods to the db_source under the repository resilience policy. |
| tests/unit/manager/repositories/app_config_fragment/test_repository.py | Real-DB tests for all-success and partial bulk create/update/purge. |
| changes/12426.feature.md | Changelog fragment describing the bulk repository operations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1 @@ | |||
| Add `app_config_fragment` bulk repository operations (`bulk_create`/`bulk_update`/`bulk_purge` with per-item partial success): bulk create relies on the allow-list FK so an item with no allow-list row is rejected per item, bulk update/purge report missing targets per item, and the `AppConfigFragmentBulkWriteResult` data type carries the partial result | |||
Summary
Repository-layer
app_config_fragmentbulk operations, split out of #12401 (BA-6618) to keep that PR reviewable. No API/service surface here — the service layer stacks on top. Built on the generic partial bulk ops already inWriteOps(bulk_create_partial/bulk_update_partial/bulk_purge_partial) — no new base primitives.bulk_create(creators: Sequence[Creator[AppConfigFragmentRow]])— no write-gate: the FK to the allow-list is the gate, so an item with no allow-list row for its(config_name, scope_type)fails per item asAppConfigFragmentWriteNotAllowed(via the spec's integrity checks), and a duplicate natural key fails likewise. Each insert runs in its own savepoint for partial success.bulk_update(updaters)/bulk_purge(purgers)— likewise no gate: a fragment row exists only while its allow-list entry does (FK with cascade, feat(BA-6704): cascade app config subtree deletion from the definition #12518), so an existing fragment is always writable at its own scope. Missing targets are reported as per-item not-found failures (the generic partial ops silently skip a missing PK).AppConfigFragmentBulkWriteResultdata type (succeeded+failed[index, message]).📚 Stacked PRs
Part of the AppConfigFragment / AppConfig stack under BEP-1052 (epic BA-5781). Merge in order:
feat(BA-6552): app_config_fragments DB model and Alembic migrationfeat(BA-6553): repository layerrefactor(BA-6619): consolidate AppConfigScopeType into common.datarefactor(BA-6620): ExistsQuerier + AppConfigAllowList.existsfeat(BA-6554): AppConfigFragment service layerfeat(BA-6628): move fragment rank to the allow list with scope defaults(replaces feat(BA-6628): conditional-bulk repository primitives #12429)feat(BA-6628): expose allow-list rank on the v2 API surfacefeat(BA-6628): cascade fragment deletion from the allow listfeat(BA-6626): app_config_fragment bulk repository layer← you are herefeat(BA-6618): AppConfigFragment bulk CRUD service layerfeat(BA-6555): app_config service layer (merge engine)feat(BA-6556): AppConfig REST v2 API📚 Documentation preview 📚: https://sorna--12426.org.readthedocs.build/en/12426/
📚 Documentation preview 📚: https://sorna-ko--12426.org.readthedocs.build/ko/12426/